Q:
How do I measure the width of my text before drawing it with
Core Graphics?
A:
First call CGContextGetTextPosition to find the current text
position. Then, set the text drawing mode to kCGTextInvisible
using CGContextSetTextDrawingMode and draw the text. Finally,
call CGContextGetTextPosition again to determine the final
text position. Take the difference between the starting
and ending positions to find the width of your text.
[Jul 02 2001]
|